package com.gt.andr.webbrowser;

import java.io.File;
import java.io.StringWriter;

import javax.xml.transform.Result;
import javax.xml.transform.Source;
import javax.xml.transform.Transformer;
import javax.xml.transform.TransformerException;
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.stream.StreamResult;
import javax.xml.transform.stream.StreamSource;

import android.os.Environment;

public class UserXmlTransform {
	static final String sdPath=Environment.getExternalStorageDirectory().getAbsolutePath();
	static final File xmlFileF = new File(sdPath+"/users.xml");
	static final File xsltFileF = new File(sdPath+"/users.xsl");
	public static String getTransformedHtml() throws TransformerException {
//		Source srcXml = new StreamSource(xmlFileF);
//		Source srcXsl = new StreamSource(xsltFileF);
//		StringWriter writer = new StringWriter();
//		Result result = new StreamResult(writer);
//		TransformerFactory tFactory = TransformerFactory.newInstance();
//		Transformer transformer = tFactory.newTransformer(srcXsl);
//		transformer.transform(srcXml, result);
//		return writer.toString();
		
		

      Source xmlSource = new StreamSource(xmlFileF);
      Source xsltSource = new StreamSource(xsltFileF);
      
      TransformerFactory transFact =
              TransformerFactory.newInstance();
      Transformer trans = transFact.newTransformer(xsltSource);
      
      trans.transform(xmlSource, new StreamResult(System.out));
    
		return "";
	}
}
